package com.dsj.gxrd.modules.controller.activity;

import com.dsj.gxrd.modules.activity.domain.dto.RdGroupDto;
import com.dsj.gxrd.modules.activity.domain.entity.RdPairing;
import com.dsj.gxrd.modules.activity.domain.vo.GroupUserVo;
import com.dsj.gxrd.modules.activity.domain.vo.RdGroupVo;
import com.dsj.gxrd.modules.activity.service.RdGroupService;
import com.dsj.gxrd.modules.activity.service.RdPairingService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * @author songpin566
 * @date 2023/09/14
 **/
@Api(tags = "结对联系")
@RestController
@RequestMapping("/pairing/contact")
public class RdPairingController extends BaseController {

    @Autowired
    private RdPairingService rdPairingService;


    @RequiresPermissions("pairing:contact:list")
    @GetMapping("/list")
    public TableDataInfo list(RdPairing pairing) {
        startPage();
        List<RdPairing> list = rdPairingService.selectPairingList(pairing);
        return getDataTable(list);
    }

    @RequiresPermissions("pairing:contact:add")
    @PostMapping()
    public AjaxResult add(@RequestBody RdPairing pairing) {
        return toAjax(rdPairingService.insertPairing(pairing));
    }

    @RequiresPermissions("pairing:contact:edit")
    @PutMapping()
    public AjaxResult edit(@RequestBody RdPairing pairing) {
        return toAjax(rdPairingService.updatePairing(pairing));
    }

    @RequiresPermissions("pairing:contact:del")
    @DeleteMapping("/{ids}")
    public AjaxResult removes(@PathVariable List<Long> ids) {
        return rdPairingService.removes(ids);
    }


}
